Musical melodies consist, at the least, of hierarchal grouped patterns of changing pitches and durations. Because music is an abstract language, parsing its grammatical constructs require the application of expanded semiotic and Gestalt principals. In particular, the algorithmic discretization of musical data is necessary for successful automated analysis and forms the basis for the present invention.